package com.tuzhi.auth.sys.dto;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 树形菜单结构Dto
 */
@Data
public class SysMenuTreeDto {
    private Long id;

    private String title;

    private Long pid;

    private String pids;

    private String url;

    private String perms;

    private String icon;

    private Integer type;

    private boolean visible;

    private Integer sortNum;

    //0不是子系统页面，1是子系统页面
    private Integer microAppFlag;

    //子系统访问 url
    private String microAppUrl;

//    子系统名称
    private String microAppName;

    /**
     * 标记是否有权限
     */
    private boolean exitsPerm;

    private List<SysMenuTreeDto> childMenus;

//    public SysMenuTreeDto(Long id, String title, Long pid, String pids, String url, String perms, String icon, Integer type, Integer sortNum
//    ,boolean visible) {
//        this.id = id;
//        this.title = title;
//        this.pid = pid;
//        this.pids = pids;
//        this.url = url;
//        this.perms = perms;
//        this.icon = icon;
//        this.type = type;
//        this.sortNum = sortNum;
//        this.visible=visible;
//    }

//    public SysMenuTreeDto(Long id, String title, Long pid, String pids, String url, String perms, String icon, Integer type, Integer sortNum
//            ,boolean visible,Integer microAppFlag,String microAppUrl) {
//        this.id = id;
//        this.title = title;
//        this.pid = pid;
//        this.pids = pids;
//        this.url = url;
//        this.perms = perms;
//        this.icon = icon;
//        this.type = type;
//        this.sortNum = sortNum;
//        this.visible=visible;
//        this.microAppFlag=microAppFlag;
//        this.microAppUrl=microAppUrl;
//    }

    public SysMenuTreeDto(Long id, String title, Long pid, String pids, String url, String perms, String icon, Integer type, Integer sortNum
            ,boolean visible,Integer microAppFlag,String microAppUrl,String microAppName) {
        this.id = id;
        this.title = title;
        this.pid = pid;
        this.pids = pids;
        this.url = url;
        this.perms = perms;
        this.icon = icon;
        this.type = type;
        this.sortNum = sortNum;
        this.visible=visible;
        this.microAppFlag=microAppFlag;
        this.microAppUrl=microAppUrl;
        this.microAppName=microAppName;
    }


    public void addChildMenu(SysMenuTreeDto menuTreeDto) {
        if (childMenus == null) {
            childMenus = new ArrayList<>();
        }
        childMenus.add(menuTreeDto);
    }
}
